package com.sfteam.bmw.model;

import com.jfinal.log.Log;
import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Model;

/**
 * 签到
 * 
 * @author knight322
 *
 */
@SuppressWarnings("serial")
public class Sign extends Model<Sign> {

	static Log log = Log.getLog(Sign.class);

	public static final Sign dao = new Sign();

	/**
	 * 连续签到天数
	 * 
	 * @param openid
	 * @return
	 */
	public int getCombosByOpenId(String openid) {
		return Db
				.queryInt(
						"SELECT CASE WHEN lastSignDate >= CURDATE() - 1 THEN combo ELSE 0 END AS `count` FROM t_sign WHERE openId = ?",
						openid);
	}
}
